---
title: 错误参考
i18nReady: false
githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts
---

下面是一张完整的错误列表，包含了你在使用 Astro 时可能遇到的所有报错。如需其他帮助（包括常见问题），另请参阅我们的[故障排除指南](/zh-cn/guides/troubleshooting/)。

## Astro 错误

- [**UnknownCompilerError**](/zh-cn/reference/errors/unknown-compiler-error/)<br/>Unknown compiler error.
- [**ClientAddressNotAvailable**](/zh-cn/reference/errors/client-address-not-available/)<br/>`Astro.clientAddress` is not available in current adapter.
- [**PrerenderClientAddressNotAvailable**](/zh-cn/reference/errors/prerender-client-address-not-available/)<br/>`Astro.clientAddress` cannot be used inside prerendered routes.
- [**StaticClientAddressNotAvailable**](/zh-cn/reference/errors/static-client-address-not-available/)<br/>`Astro.clientAddress` is not available in prerendered pages.
- [**NoMatchingStaticPathFound**](/zh-cn/reference/errors/no-matching-static-path-found/)<br/>No static path found for requested path.
- [**OnlyResponseCanBeReturned**](/zh-cn/reference/errors/only-response-can-be-returned/)<br/>Invalid type returned by Astro page.
- [**MissingMediaQueryDirective**](/zh-cn/reference/errors/missing-media-query-directive/)<br/>Missing value for `client:media` directive.
- [**NoMatchingRenderer**](/zh-cn/reference/errors/no-matching-renderer/)<br/>No matching renderer found.
- [**NoClientEntrypoint**](/zh-cn/reference/errors/no-client-entrypoint/)<br/>No client entrypoint specified in renderer.
- [**NoClientOnlyHint**](/zh-cn/reference/errors/no-client-only-hint/)<br/>Missing hint on `client:only` directive.
- [**InvalidGetStaticPathParam**](/zh-cn/reference/errors/invalid-get-static-path-param/)<br/>Invalid value returned by a `getStaticPaths` path.
- [**InvalidGetStaticPathsEntry**](/zh-cn/reference/errors/invalid-get-static-paths-entry/)<br/>Invalid entry inside getStaticPath's return value
- [**InvalidGetStaticPathsReturn**](/zh-cn/reference/errors/invalid-get-static-paths-return/)<br/>Invalid value returned by getStaticPaths.
- [**GetStaticPathsExpectedParams**](/zh-cn/reference/errors/get-static-paths-expected-params/)<br/>Missing params property on `getStaticPaths` route.
- [**GetStaticPathsInvalidRouteParam**](/zh-cn/reference/errors/get-static-paths-invalid-route-param/)<br/>Invalid value for `getStaticPaths` route parameter.
- [**GetStaticPathsRequired**](/zh-cn/reference/errors/get-static-paths-required/)<br/>`getStaticPaths()` function required for dynamic routes.
- [**ReservedSlotName**](/zh-cn/reference/errors/reserved-slot-name/)<br/>Invalid slot name.
- [**NoAdapterInstalled**](/zh-cn/reference/errors/no-adapter-installed/)<br/>Cannot use Server-side Rendering without an adapter.
- [**AdapterSupportOutputMismatch**](/zh-cn/reference/errors/adapter-support-output-mismatch/)<br/>Adapter does not support server output.
- [**NoAdapterInstalledServerIslands**](/zh-cn/reference/errors/no-adapter-installed-server-islands/)<br/>Cannot use Server Islands without an adapter.
- [**NoMatchingImport**](/zh-cn/reference/errors/no-matching-import/)<br/>No import found for component.
- [**InvalidPrerenderExport**](/zh-cn/reference/errors/invalid-prerender-export/)<br/>Invalid prerender export.
- [**InvalidComponentArgs**](/zh-cn/reference/errors/invalid-component-args/)<br/>Invalid component arguments.
- [**PageNumberParamNotFound**](/zh-cn/reference/errors/page-number-param-not-found/)<br/>Page number param not found.
- [**ImageMissingAlt**](/zh-cn/reference/errors/image-missing-alt/)<br/>Image missing required "alt" property.
- [**InvalidImageService**](/zh-cn/reference/errors/invalid-image-service/)<br/>Error while loading image service.
- [**MissingImageDimension**](/zh-cn/reference/errors/missing-image-dimension/)<br/>Missing image dimensions
- [**FailedToFetchRemoteImageDimensions**](/zh-cn/reference/errors/failed-to-fetch-remote-image-dimensions/)<br/>Failed to retrieve remote image dimensions
- [**UnsupportedImageFormat**](/zh-cn/reference/errors/unsupported-image-format/)<br/>Unsupported image format
- [**UnsupportedImageConversion**](/zh-cn/reference/errors/unsupported-image-conversion/)<br/>Unsupported image conversion
- [**PrerenderDynamicEndpointPathCollide**](/zh-cn/reference/errors/prerender-dynamic-endpoint-path-collide/)<br/>Prerendered dynamic endpoint has path collision.
- [**PrerenderRouteConflict**](/zh-cn/reference/errors/prerender-route-conflict/)<br/>Prerendered route generates the same path as another route.
- [**ExpectedImage**](/zh-cn/reference/errors/expected-image/)<br/>Expected src to be an image.
- [**ExpectedImageOptions**](/zh-cn/reference/errors/expected-image-options/)<br/>Expected image options.
- [**ExpectedNotESMImage**](/zh-cn/reference/errors/expected-not-esmimage/)<br/>Expected image options, not an ESM-imported image.
- [**IncompatibleDescriptorOptions**](/zh-cn/reference/errors/incompatible-descriptor-options/)<br/>Cannot set both `densities` and `widths`
- [**ImageNotFound**](/zh-cn/reference/errors/image-not-found/)<br/>Image not found.
- [**NoImageMetadata**](/zh-cn/reference/errors/no-image-metadata/)<br/>Could not process image metadata.
- [**CouldNotTransformImage**](/zh-cn/reference/errors/could-not-transform-image/)<br/>Could not transform image.
- [**ResponseSentError**](/zh-cn/reference/errors/response-sent-error/)<br/>Unable to set response.
- [**MiddlewareNoDataOrNextCalled**](/zh-cn/reference/errors/middleware-no-data-or-next-called/)<br/>The middleware didn't return a `Response`.
- [**MiddlewareNotAResponse**](/zh-cn/reference/errors/middleware-not-aresponse/)<br/>The middleware returned something that is not a `Response` object.
- [**EndpointDidNotReturnAResponse**](/zh-cn/reference/errors/endpoint-did-not-return-aresponse/)<br/>The endpoint did not return a `Response`.
- [**LocalsNotAnObject**](/zh-cn/reference/errors/locals-not-an-object/)<br/>Value assigned to `locals` is not accepted.
- [**LocalsReassigned**](/zh-cn/reference/errors/locals-reassigned/)<br/>`locals` must not be reassigned.
- [**AstroResponseHeadersReassigned**](/zh-cn/reference/errors/astro-response-headers-reassigned/)<br/>`Astro.response.headers` must not be reassigned.
- [**MiddlewareCantBeLoaded**](/zh-cn/reference/errors/middleware-cant-be-loaded/)<br/>Can't load the middleware.
- [**LocalImageUsedWrongly**](/zh-cn/reference/errors/local-image-used-wrongly/)<br/>Local images must be imported.
- [**AstroGlobUsedOutside**](/zh-cn/reference/errors/astro-glob-used-outside/)<br/>Astro.glob() used outside of an Astro file.
- [**AstroGlobNoMatch**](/zh-cn/reference/errors/astro-glob-no-match/)<br/>Astro.glob() did not match any files.
- [**RedirectWithNoLocation**](/zh-cn/reference/errors/redirect-with-no-location/)<br/>A redirect must be given a location with the `Location` header.
- [**UnsupportedExternalRedirect**](/zh-cn/reference/errors/unsupported-external-redirect/)<br/>Unsupported or malformed URL.
- [**InvalidDynamicRoute**](/zh-cn/reference/errors/invalid-dynamic-route/)<br/>Invalid dynamic route.
- [**MissingSharp**](/zh-cn/reference/errors/missing-sharp/)<br/>Could not find Sharp.
- [**UnknownViteError**](/zh-cn/reference/errors/unknown-vite-error/)<br/>Unknown Vite Error.
- [**FailedToLoadModuleSSR**](/zh-cn/reference/errors/failed-to-load-module-ssr/)<br/>Could not import file.
- [**InvalidGlob**](/zh-cn/reference/errors/invalid-glob/)<br/>Invalid glob pattern.
- [**FailedToFindPageMapSSR**](/zh-cn/reference/errors/failed-to-find-page-map-ssr/)<br/>Astro couldn't find the correct page to render
- [**MissingLocale**](/zh-cn/reference/errors/missing-locale/)<br/>The provided locale does not exist.
- [**MissingIndexForInternationalization**](/zh-cn/reference/errors/missing-index-for-internationalization/)<br/>Index page not found.
- [**IncorrectStrategyForI18n**](/zh-cn/reference/errors/incorrect-strategy-for-i18n/)<br/>You can't use the current function with the current strategy
- [**NoPrerenderedRoutesWithDomains**](/zh-cn/reference/errors/no-prerendered-routes-with-domains/)<br/>Prerendered routes aren't supported when internationalization domains are enabled.
- [**MissingMiddlewareForInternationalization**](/zh-cn/reference/errors/missing-middleware-for-internationalization/)<br/>Enabled manual internationalization routing without having a middleware.
- [**CantRenderPage**](/zh-cn/reference/errors/cant-render-page/)<br/>Astro can't render the route.
- [**UnhandledRejection**](/zh-cn/reference/errors/unhandled-rejection/)<br/>Unhandled rejection
- [**i18nNotEnabled**](/zh-cn/reference/errors/i18n-not-enabled/)<br/>i18n Not Enabled
- [**i18nNoLocaleFoundInPath**](/zh-cn/reference/errors/i18n-no-locale-found-in-path/)<br/>The path doesn't contain any locale
- [**RouteNotFound**](/zh-cn/reference/errors/route-not-found/)<br/>Route not found.
- [**EnvInvalidVariables**](/zh-cn/reference/errors/env-invalid-variables/)<br/>Invalid Environment Variables
- [**ServerOnlyModule**](/zh-cn/reference/errors/server-only-module/)<br/>Module is only available server-side
- [**RewriteWithBodyUsed**](/zh-cn/reference/errors/rewrite-with-body-used/)<br/>Cannot use Astro.rewrite after the request body has been read
- [**ForbiddenRewrite**](/zh-cn/reference/errors/forbidden-rewrite/)<br/>Forbidden rewrite to a static route.
- [**UnknownFilesystemError**](/zh-cn/reference/errors/unknown-filesystem-error/)<br/>An unknown error occurred while reading or writing files to disk.
- [**CannotExtractFontType**](/zh-cn/reference/errors/cannot-extract-font-type/)<br/>Cannot extract the font type from the given URL.
- [**CannotDetermineWeightAndStyleFromFontFile**](/zh-cn/reference/errors/cannot-determine-weight-and-style-from-font-file/)<br/>Cannot determine weight and style from font file.
- [**CannotFetchFontFile**](/zh-cn/reference/errors/cannot-fetch-font-file/)<br/>Cannot fetch the given font file.
- [**CannotLoadFontProvider**](/zh-cn/reference/errors/cannot-load-font-provider/)<br/>Cannot load font provider
- [**ExperimentalFontsNotEnabled**](/zh-cn/reference/errors/experimental-fonts-not-enabled/)<br/>Experimental fonts are not enabled
- [**FontFamilyNotFound**](/zh-cn/reference/errors/font-family-not-found/)<br/>Font family not found
- [**CspNotEnabled**](/zh-cn/reference/errors/csp-not-enabled/)<br/>CSP feature isn't enabled

## CSS 错误

- [**UnknownCSSError**](/zh-cn/reference/errors/unknown-csserror/)<br/>Unknown CSS Error.
- [**CSSSyntaxError**](/zh-cn/reference/errors/csssyntax-error/)<br/>CSS Syntax Error.

## Markdown 错误

- [**UnknownMarkdownError**](/zh-cn/reference/errors/unknown-markdown-error/)<br/>Unknown Markdown Error.
- [**MarkdownFrontmatterParseError**](/zh-cn/reference/errors/markdown-frontmatter-parse-error/)<br/>Failed to parse Markdown frontmatter.
- [**InvalidFrontmatterInjectionError**](/zh-cn/reference/errors/invalid-frontmatter-injection-error/)<br/>Invalid frontmatter injection.
- [**MdxIntegrationMissingError**](/zh-cn/reference/errors/mdx-integration-missing-error/)<br/>MDX integration missing.
- [**UnknownConfigError**](/zh-cn/reference/errors/unknown-config-error/)<br/>Unknown configuration error.
- [**ConfigNotFound**](/zh-cn/reference/errors/config-not-found/)<br/>Specified configuration file not found.
- [**ConfigLegacyKey**](/zh-cn/reference/errors/config-legacy-key/)<br/>Legacy configuration detected.

## CLI 错误

- [**UnknownCLIError**](/zh-cn/reference/errors/unknown-clierror/)<br/>Unknown CLI Error.
- [**RenderUndefinedEntryError**](/zh-cn/reference/errors/render-undefined-entry-error/)<br/>Attempted to render an undefined content collection entry.
- [**GenerateContentTypesError**](/zh-cn/reference/errors/generate-content-types-error/)<br/>Failed to generate content types.

## 内容集合错误

- [**UnknownContentCollectionError**](/zh-cn/reference/errors/unknown-content-collection-error/)<br/>Unknown Content Collection Error.
- [**GetEntryDeprecationError**](/zh-cn/reference/errors/get-entry-deprecation-error/)<br/>Invalid use of `getDataEntryById` or `getEntryBySlug` function.
- [**InvalidContentEntryFrontmatterError**](/zh-cn/reference/errors/invalid-content-entry-frontmatter-error/)<br/>Content entry frontmatter does not match schema.
- [**InvalidContentEntryDataError**](/zh-cn/reference/errors/invalid-content-entry-data-error/)<br/>Content entry data does not match schema.
- [**ContentLoaderReturnsInvalidId**](/zh-cn/reference/errors/content-loader-returns-invalid-id/)<br/>Content loader returned an entry with an invalid `id`.
- [**ContentEntryDataError**](/zh-cn/reference/errors/content-entry-data-error/)<br/>Content entry data does not match schema.
- [**LiveContentConfigError**](/zh-cn/reference/errors/live-content-config-error/)<br/>Error in live content config.
- [**ContentLoaderInvalidDataError**](/zh-cn/reference/errors/content-loader-invalid-data-error/)<br/>Content entry is missing an ID
- [**InvalidContentEntrySlugError**](/zh-cn/reference/errors/invalid-content-entry-slug-error/)<br/>Invalid content entry slug.
- [**ContentSchemaContainsSlugError**](/zh-cn/reference/errors/content-schema-contains-slug-error/)<br/>Content Schema should not contain `slug`.
- [**MixedContentDataCollectionError**](/zh-cn/reference/errors/mixed-content-data-collection-error/)<br/>Content and data cannot be in same collection.
- [**ContentCollectionTypeMismatchError**](/zh-cn/reference/errors/content-collection-type-mismatch-error/)<br/>Collection contains entries of a different type.
- [**DataCollectionEntryParseError**](/zh-cn/reference/errors/data-collection-entry-parse-error/)<br/>Data collection entry failed to parse.
- [**DuplicateContentEntrySlugError**](/zh-cn/reference/errors/duplicate-content-entry-slug-error/)<br/>Duplicate content entry slug.
- [**UnsupportedConfigTransformError**](/zh-cn/reference/errors/unsupported-config-transform-error/)<br/>Unsupported transform in content config.
- [**FileParserNotFound**](/zh-cn/reference/errors/file-parser-not-found/)<br/>File parser not found
- [**FileGlobNotSupported**](/zh-cn/reference/errors/file-glob-not-supported/)<br/>Glob patterns are not supported in the file loader

## Action 错误

- [**ActionsWithoutServerOutputError**](/zh-cn/reference/errors/actions-without-server-output-error/)<br/>Actions must be used with server output.
- [**ActionsReturnedInvalidDataError**](/zh-cn/reference/errors/actions-returned-invalid-data-error/)<br/>Action handler returned invalid data.
- [**ActionNotFoundError**](/zh-cn/reference/errors/action-not-found-error/)<br/>Action not found.
- [**ActionCalledFromServerError**](/zh-cn/reference/errors/action-called-from-server-error/)<br/>Action unexpected called from the server.
- [**ActionsCantBeLoaded**](/zh-cn/reference/errors/actions-cant-be-loaded/)<br/>Can't load the Astro actions.

## Session（会话）错误

- [**SessionStorageInitError**](/zh-cn/reference/errors/session-storage-init-error/)<br/>Session storage could not be initialized.
- [**SessionStorageSaveError**](/zh-cn/reference/errors/session-storage-save-error/)<br/>Session data could not be saved.
- [**SessionWithoutSupportedAdapterOutputError**](/zh-cn/reference/errors/session-without-supported-adapter-output-error/)<br/>Sessions cannot be used with an adapter that doesn't support server output.
- [**SessionConfigMissingError**](/zh-cn/reference/errors/session-config-missing-error/)<br/>Session storage was enabled but not configured.
- [**SessionConfigWithoutFlagError**](/zh-cn/reference/errors/session-config-without-flag-error/)<br/>Session flag not set
